import request from "@/utils/request.ts";
import type {HospitalResponseData, HospitalLevelAndRegionResponseData, HospitalInfo} from "@/api/home/type.ts";

enum API{
    // 获取已有的医院的数据接口地址
    HOSPITAL_URL = '/api/hosp/hospital',
    //获取医院的等级与地区接口
    HOSPITALLEVELANDREGION_URL='/api/cmn/dict/findByDictCode/',
    //根据关键字医院的名字获取数据
    HOSPITALINFO_URL='/api/hosp/hospital/findByHosname/'
}
//获取医院的数据
export const  reqHospital =(page:number,limit:number,hostype='',districtCode='')=>{
    return  request.get<any,HospitalResponseData>(API.HOSPITAL_URL+`/${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`)
}
//取医院的等级与地区
export const reqHospitalLevelAndRegion =(dictCode:string)=>{
    return request.get<any,HospitalLevelAndRegionResponseData>(API.HOSPITALLEVELANDREGION_URL+`${dictCode}`)
}
//根据关键字医院的名字获取数据
export const reqHospitalInfo =(keyWord:string)=>{
    return request.get<any,HospitalInfo>(API.HOSPITALINFO_URL+`${keyWord}`)
}